package cn.glc.daily.life.model.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 优先级(任务等级)
 *
 * @author simon
 * @date 2021/5/12 15:59
 * @copyright:
 * @modifier
 * @motto a no talent, people who have to study hard
 */
@Getter
@AllArgsConstructor
public enum TaskPriorityEnums {


    PRIORITY_ZERO(0, "无优先级"),

    PRIORITY_LOW(1, "低优先级"),

    PRIORITY_MEDIUM(2, "中优先级"),

    PRIORITY_TOP(3, "高优先级"),

    OTHER(999, "错误优先级");

    private final Integer priority;
    private final String desc;

    public static TaskPriorityEnums match(Integer priority) {
        for (TaskPriorityEnums taskLevel : values()) {
            if (taskLevel.getPriority().equals(priority)) {
                return taskLevel;
            }
        }
        return null;
    }
}
